package com.swufe.team;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class RateOption extends AppCompatActivity {
    float rate;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_rate_option);

        Intent intent = getIntent();
        rate=intent.getFloatExtra("Rate_Value",0.0f);
        String title=intent.getStringExtra("Rate_Title");


        TextView stype=findViewById(R.id.textView);
        stype.setText(""+title);

    }
    public void opClick(View btn){
        EditText input=findViewById(R.id.option);
        String str=input.getText().toString();
        float r=0.0f;
        float inp=Float.parseFloat(str);
        if (str.length() == 0) {
            Toast.makeText(this, "请输入数据", Toast.LENGTH_SHORT).show();
        } else {

            r=inp*rate;
        }
        TextView result2=findViewById(R.id.result2);
        result2.setText("兑换:"+r);

    }
}